<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>湖南涉外经济学院论坛</title>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="css/style1.css" type="text/css" media="all" />
<script type="text/javascript" src="js/jquery-1.7.2.js"></script>
<script src="js/client_validate.js"></script>
<script type="text/javascript">
	function loginUserInfo(){
	
		var loginuserinfo=document.getElementById("loginuser_email1");
			if(trim(loginuserinfo.value)==""){
				alert("账号不能为空");
				return  ;
			}
			var password=document.getElementById("loginuser_password1");
			if(trim(password.value)==""){
				alert("密码不能为空");
				return ;
			}	
			
		 $.ajax({
				type: "POST",
				url: "bbsUserInfo_checkLogin.do",
				dateType: "html",
				data: {'bbsUserInfo.email': $("#loginuser_email1").val(),
						'bbsUserInfo.password': $("#loginuser_password1").val()},
				success: function(returnedData){
					if(returnedData=="this"){
						alert("用户名或密码不正确，请重新输入");
					}else{
						$("#login1").submit();
					}
					
				}
			});
	}
	function checkUser(){
	
			$.ajax({
				type: "POST",
				url: "bbsUserInfo_isLogin.do",
				dateType: "html",
				success: function(returnedData){
					if(returnedData=="null"){
						alert("没有登录，不能发帖，请登录系统！");
					}else{
						$("#bbsTitleInfo_addShow").submit();
					}
				}
				
			});
	}
</script>

</head>
<body>
<!-- Logo + Navigation -->
<div id="top">
  <div class="shell">
			<form action="bbsUserInfo_login.do" method="post" id="login1" name="login">				
				<div id="navigation">
					<c:if test="${sessionScope.bbsUserInfo==null}">
					 <table>
						<tr>
							<td style="color: #fff">账号：</td>
							<td><input type="text" name="bbsUserInfo.email" id=loginuser_email1 size="30px"></td>
						</tr>
						<tr>
							<td style="color: #fff">密码：</td>
							<td><input type="text" name="bbsUserInfo.password" id="loginuser_password1" size="30px"></td>
						</tr>
				  </table>
				   <ul>
					<li><a href="#" onclick="loginUserInfo()" >登录</a></li>
					<li><a href="register.jsp" >注册</a></li>
					<li><a href="login.jsp">后台登陆</a></li>
				  </ul>
				  </c:if>
				  
				  <c:if test="${sessionScope.bbsUserInfo!=null}">
				  <ul>
					<li><a href="#" onclick="">${sessionScope.bbsUserInfo.username }</a></li>
					<li><a href="bbsUserInfo_logout.do" >注销</a></li>
					<c:if test="${sessionScope.bbsUserInfo.userLevel==5}">
						<li><a href="../bbs/main.jsp">后台管理</a></li>
					</c:if>
				  </ul>
				  </c:if>
				</div>
			</form>	
  </div>
</div>
<!-- End Logo + Navigation -->
<!-- Slider -->
<div id="header" class="div1">
<br>
  <h1 style="color: red;font-size: 80px;">湖南涉外经济学院论坛</h1>
</div>
<!-- End Slider -->
<!-- Main -->
<div>
	<div style="float: left;">
	<form class="form-wrapper cf" action="bbsTitleInfo_findByProperty.do" method="post">
		
		<input type="text" placeholder="请输入搜索内容" required name="bbsUserInfo.titleTitle">
		<button type="submit">Search</button>
	</form>
	</div>
	<div style="float: right;padding-right: 20px">
		<form action="bbsTitleInfo_addShow.do" method="post" id="bbsTitleInfo_addShow">
			<input type="hidden" name="bbsTitleInfo.titleBlockid" value="${bbsTitleInfo.titleBlockid}"/>
			<input type ="button" value="发帖" onclick="checkUser()" style="width: 100px"/> 
		</form>
	</div>
</div>
<div id="main">
	<table width="100%" id="mytab"  border="1" class="t2">
 
  <tr >
    <td width="60%" align="left"><span style="color: red;">标题</span></td>
    <td width="10%" align="center"><span style="color: red;">作者</span></td>
    <td width="7%" align="center"><span style="color: red;">回复</span></td>
    <td width="10%" align="center"><span style="color: red;">最后发表</span></td>
  </tr>
  <c:forEach items="${bbsTitleInfoList}" var="title">
  <tr>
    <td><a href="bbsReplyInfo_showReply.do?id=${title.titleId}">${title.titleTitle }</a></td>
    <td align="center">
    	<a href="#">${title.titleUsername }</a><br>
    	${title.titleCreateTime }
    </td>
    <td align="center">
    	${title.titleReplyNum }
   	</td>
    <td align="center">
    	<a href="#">${title.titleLastReplyUsername }</a><br>
    	${title.titleLastReplyTime }
    </td>
  </tr>
  </c:forEach>
  <tr>
  	<td>
  		&nbsp&nbsp&nbsp&nbsp&nbsp 第   ${page} 页  
  	&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp 共  ${maxpage }页 
  	
  	</td>
  	<td colspan="2" align="center">
  		<a href="bbsTitleInfo_showmainTitleInfo.do?page=1">首页</a>
  		<a href="bbsTitleInfo_prePage.do?page=${page}">&nbsp&nbsp&nbsp上一页</a>
  		<a href="bbsTitleInfo_nextPage.do?page=${page}">&nbsp&nbsp&nbsp下一页</a>
  		<a href="bbsTitleInfo_showmainTitleInfo.do?page=${maxpage }">&nbsp&nbsp&nbsp末页</a></td>
  	<td align="center">转到  <input type="text" size="2px"> 页</td>
  </tr>
</table>

</div>
<!-- End Main -->
<!-- Footer -->
<div id="footer">
  <div class="shell"> <span class="left">湖南涉外经济学院校园论坛</span> <span class="right"> &copy; 2013 - CompanyName &nbsp; Design by <a href="">湖南涉外经济学院</a> </span> </div>
</div>
<!-- End Footer -->
</body>
</html>
